<script type="text/javascript">
$(document).ready(function(){
	
	$('#dt-view').dataTable( {
		"aaSorting": [[ 1, "asc" ]],
		"aoColumns": [				
		<?php switch($field_count){ 
			case 2:
		?>
			{ "sWidth": "25%","sClass": "center" },
			{ "sWidth": "25%", "sClass": "center", "bSortable": false },
		<?php break;
			case 3:
		?>
			{ "sWidth": "25%","sClass": "center" },
			{ "sWidth": "25%" },		
			{ "sWidth": "25%", "sClass": "center", "bSortable": false },
		<?php break; 
			case 4:
		?>
			{ "sWidth": "25%","sClass": "center" },
			{ "sWidth": "25%" },
			{ "sWidth": "25%" },
			{ "sWidth": "25%", "sClass": "center", "bSortable": false },
		<?php break; 		
			case 5:
		?>
			{ "sWidth": "20%","sClass": "center" },
			{ "sWidth": "20%" },
			{ "sWidth": "20%" },
			{ "sWidth": "20%" },
			{ "sWidth": "20%", "sClass": "center", "bSortable": false },
		<?php break; 		
			default:
		?>
			{ "sWidth": "20%","sClass": "center" },
			{ "sWidth": "15%" },
			{ "sWidth": "15%" },
			{ "sWidth": "15%" },
			{ "sWidth": "15%" },
			{ "sWidth": "20%", "sClass": "center", "bSortable": false },		
		<?php } ?>
		]
	} );	
	
	$('.delete-modal').live('click', function () {
		var id = $(this).attr('id');		
		var table = $(this).attr('rel');		
		$('#delete-value').val(id);		
	});
	
	
	$(".delete-item").live('click',function(e){			
						
			var data = {'table':'<?php echo $table ?>','id':$("#delete-value").val()};
			$.ajax({
				type:'post',
				url:base_url+'admin/delete_item',
				data:data,
				dataType:'json',
				success:function(ret)
				{		
					//alert(ret.message);
					document.location='';
				}
			});			
		});
		
	
});
</script>